package com.goockr.verificationdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class LoginActivity extends AppCompatActivity {
    App app;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        app=(App) getApplication();
        setContentView(R.layout.activity_login);
        Button bt_Login =(Button)findViewById(R.id.bt_Login);
        bt_Login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                boolean isVerification =  app.preferences.getBoolean("isVerification",false);//获取验证的标志位值
                if (isVerification)//如果验证过直接进入主页
                {
                    Intent intent1=new Intent(LoginActivity.this,MainActivity.class);
                    startActivity(intent1);
                }else //没有验证过进入验证页面
                {
                    Intent intent2=new Intent(LoginActivity.this,VerificationActivity.class);
                    startActivity(intent2);
                }
            }
        });
    }
}
